package com.sina.common.util.bean;

import java.io.Serializable;

/*
 * CallLog.Calls.CACHED_NAME, // 联系人
 *
 * CallLog.Calls.NUMBER, // 号码
 *
 * CallLog.Calls.DATE,   // 日期
 *
 * CallLog.Calls.TYPE    // 类型：来电、去电、未接
 *
 * CallLog.Calls.DURATION  // 通话时长
 *
 * Created by WT on 2017/10/16.
 */

/**
 * 联系人信息类
 */
public class CallRdsInfo implements Serializable {

    private String phoneNo; // 原始:152-0619-0302
    private String callTime;     // yyyy-MM-dd HH:mm:ss
    private int callType;      // 呼入1；呼出0
    private int isThrough;      // 1接通0未接通（通话时长大于0就是接通）
    private long callDuration;      // 毫秒ms

    public String getPhoneNo() {
        return phoneNo;
    }

    public void setPhoneNo(String phoneNo) {
        this.phoneNo = phoneNo;
    }

    public String getCallTime() {
        return callTime;
    }

    public void setCallTime(String callTime) {
        this.callTime = callTime;
    }

    public int getCallType() {
        return callType;
    }

    public void setCallType(int callType) {
        switch (callType) {
            case 1:
                this.callType = 1;
                break;
            case 2:
                this.callType = 0;
                break;
            case 3:
                this.callDuration = 0;
                this.isThrough = 0;
                this.callType = 1;
                break;
        }
    }

    public long getCallDuration() {
        return callDuration;
    }

    public void setCallDuration(long callDuration) {
        this.callDuration = callDuration * 1000;

        if (callDuration > 0) {
            this.isThrough = 1;
        } else {
            this.isThrough = 0;
        }
    }

    @Override
    public String toString() {
        return "CallRdsInfo{" + "phoneNo='" + phoneNo + '\'' + ", callTime='" + callTime + '\'' + ", callType=" + callType + ", isThrough=" + isThrough + ", callDuration=" + callDuration + '}';
    }
}
